取件和齐件状态.sql 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. USE [DYBBERPDB]
  2. GO
  3. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fun_GetPickupStatusStatus]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
  4. DROP FUNCTION [dbo].[fun_GetPickupStatusStatus]
  5. GO
  6. CREATE function [dbo].[fun_GetPickupStatusStatus](@status int,@productCount int)
  7. /******
  8. 获取取件状态
  9. 创建人:刘工
  10. 创建日期:2015-09-22
  11. 修改人:
  12. 修改说明:
  13. 修改日期:
  14. ******/
  15. Returns varchar(50)
  16. As
  17. Begin
  18. Declare @Return varchar(50)
  19. set @Return = '未取'
  20. if @status= @productCount and @status>0
  21. begin
  22. set @Return = 'OK'
  23. end
  24. else if @status>0 and @status< @productCount
  25. begin
  26. set @Return = '部分取件'
  27. end
  28. Return @Return
  29. End
  30. GO
  31. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fun_GetCompletedStatus]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
  32. DROP FUNCTION [dbo].[fun_GetCompletedStatus]
  33. GO
  34. CREATE function [dbo].[fun_GetCompletedStatus](@status int,@productCount int)
  35. /******
  36. 获取齐件状态
  37. 创建人:刘工
  38. 创建日期:2015-09-22
  39. 修改人:
  40. 修改说明:
  41. 修改日期:
  42. ******/
  43. Returns varchar(50)
  44. As
  45. Begin
  46. Declare @Return varchar(50)
  47. set @Return = '未完'
  48. if @status= @productCount and @status>0
  49. begin
  50. set @Return = 'OK'
  51. end
  52. else if @status>0 and @status< @productCount
  53. begin
  54. set @Return = '部分完件'
  55. end
  56. Return @Return
  57. End
  58. GO